{% extends "layouts" ~ DIR ~ "default.twig" %}

{% block content %}

{% if months is not empty %}
{# Months? (For yearly archives) #}
<h2>{{ "Archive of %s" | translate | format(archive.when | time("Y")) }}</h2>
<ul>
{% for when, month in months %}
<li>
<h3>
<a href="{{ url('archive/%s/' | format(when | dateformat('Y/m'))) }}">
{{ when | time("F" | translate, "title") }}
</a>
</h3>
<ul>
{% for post in month %}
<li>
<a href="{{ post.url() }}" rel="bookmark" title="{{ 'Permanent link to &#8220;%s&#8221;' | translate | format(post.title() | striptags | fix(true)) }}">
{{ post.title() }}
</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% if archive.prev is not empty or archive.next is not empty %}
<nav class="traversal">
<ul class="navigation">
{% if archive.prev is not empty %}
<li>
<a href="{{ url('archive/%s/' | format(archive.prev | dateformat('Y'))) }}">
{{- "Newer posts" | translate -}}
</a>
</li>
{% endif %}
{% if archive.next is not empty %}
<li>
<a href="{{ url('archive/%s/' | format(archive.next | dateformat('Y'))) }}">
{{- "Older posts" | translate -}}
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% elseif posts.paginated is not empty %}
{# Posts? (For daily/monthly archives) #}
<div class="filter">
{{ "Archive of %s" | translate | format(archive.when | time(archive.depth == "day" ? "d F Y" : "F Y")) }}
</div>
{% for post in posts.paginated %}
{% include(["feathers" ~ DIR ~ post.feather ~ ".twig", "feathers" ~ DIR ~ "missing.twig"]) %}
{% endfor %}
{% if posts.prev_page() or posts.next_page() %}
<!-- Navigation -->
<nav class="traversal">
<ul class="navigation">
{% if posts.prev_page() %}
<li>
{{ posts.prev_link("Newer posts" | translate) }}
</li>
{% endif %}
{% if posts.next_page() %}
<li>
{{ posts.next_link("Older posts" | translate) }}
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
{# No results #}
<div role="status">{{ "There aren't any posts in the timeframe you specified." | translate }}</div>
{% endif %}

{% endblock %}
